#!/usr/bin/bash
PATHG=$(uname -o)
####################################
updateou(){
sleep 0.5s
echo "
[1;33m————————————————————————————
[1;32m部分系统没相应的架构包，可能会导致下载不成功d(ŐдŐ๑) 
[1;36m [m
[1;33m————————————————————————————
[1;32m手上资源有限，无法每个架构都通过测试(>﹏<)
[1;36m经检测,你的CPU架构对应系统包为$(uname -m)[m
"
sleep 3.5s
date_t=`date +"%D"`
if ! grep -q $date_t ".date_tmp.log" 2>/dev/null; then
echo $date_t >>.date_tmp.log 2>&1
echo 软件源获取更新
sleep 1
apt update -y
apt upgrade -y
echo 检查基础依赖
apt install -y termux-api 2>/dev/null
apt install -y git aria2 wget neofetch bash whiptail gawk 2>/dev/null
if type pkg &>/dev/null; then
[ -d ~/.termux ]
echo "terminal-onclick-url-open=true
terminal-margin-vertical=0
terminal-margin-horizo​​ntal=0">~/.termux/termux.properties
echo "foreground=#C5C8C6
background=#000000
cursor=#C5C8C6
color0=#1D1F21
color1=#CC342B
color2=#198844
color3=#FBA922
color4=#16B1FB
color5=#A36AC7
color6=#3971ED
color7=#C5C8C6
color8=#969896
color9=#CC342B
color10=#198844
color11=#FBA922
color12=#16B1FB
color13=#A36AC7
color14=#3971ED
color15=#FFFFFF
color16=#F96A38
color17=#3971ED
color18=#282A2E
color19=#373B41
color20=#B4B7B4
color21=#E0E0E0">~/.termux/colors.properties
termux-reload-settings
fi
fi
}

####################################
menui(){
updateou
plk=$(whiptail --clear --backtitle "$PATHG" --title "$PATHG Tools" --menu "请选择你要执行的功能" 15 65 7 "1" "TMOE全能(本功能由Moe提供支持)" "2" "发行版本(本功能由yudezeng提供支持)" "3" "安装AList" "4" "Nukkit & Minecraft Server" "00" "退出"  3>&1 1>&2 2>&3)
case $plk in
1) bash -c "$(curl -L gitee.com/mo2/linux/raw/2/2)" ;;
2) bash -c "$(curl https://gitee.com/yudezeng/yutools/raw/master/yti)" ;;
3) if [ ! -d "./AList/" ];then
mkdir ./AList && cd AList
aria2c -x 4 -s 16 https://ghproxy.com/https://github.com/Xhofe/alist/releases/latest/download/alist-linux-musl-arm64.tar.gz
tar zxf alist-linux-musl-arm64.tar.gz
rm -rf alist-linux-musl-arm64.tar.gz
cd && echo "cd .termux && ./alist server">alist-server.sh && chmod 777 alist-server.sh
sleep 0.5s && echo -e "\n 输入[1;32m./alist-server.sh[m运行\n"
else
echo "已安装过 [1;32mAList"
fi ;;
4) apt -y install openjdk-17
if [ ! -d "./MC/" ];then
mkdir ./MC && cd MC
aria2c -x 4 -s 16 https://ci.opencollab.dev/job/NukkitX/job/Nukkit/job/master/lastSuccessfulBuild/artifact/target/nukkit-1.0-SNAPSHOT.jar
cd && echo "cd MC && java -jar nukkit-1.0-SNAPSHOT.jar">Nukkit-Server.sh && chmod 777 Nukkit-Server.sh
sleep 0.5s && echo -e "\n 输入[1;32m./Nukkit-Server.sh[m运行\n"
else
echo "已安装过 [1;32mNukkit & Minecraft Server"
fi ;;
00) exit 1 ;;
esac
}
menui
